<%--
  User: Shengzhao Li
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ taglib prefix="form" uri="http://www.springframework.org/tags/form" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<html>
<head>
    <title>设置</title>
</head>
<body>
<div id="thing_setting_page" data-role="page" class="page">
    <div data-role="header" data-theme="f">
        <a href="${contextPath}/m/dashboard" data-icon="home" data-direction="reverse"
           data-transition="slide">主页</a>

        <h1>设置</h1>
        <a href="../overview" data-icon="arrow-l" data-direction="reverse" data-transition="flip">返回</a>
    </div>
    <div data-role="content">
        <div class="center red" style="display: none;" id="update_info">更新成功!</div>
        <p class="ui-bar-d ui-corner-top ui-corner-bottom details-area center">
            每个时刻,我的脑子里都计划着一些事情,我把它记下来,设定优先级,然后一件件去完成它...
        </p>
        <form:form commandName="thingSettingDto" id="thing_setting_form" data-ajax="false"
                   onsubmit="$.mobile.showPageLoadingMsg();">
            <ul data-role="listview" data-inset="true">
                <li>
                    <div data-role="fieldcontain">
                        <label for="autoStartThing">是否自动开始事情(仅限有开始时间的事情):</label>
                        <select name="autoStartThing" data-role="slider" id="autoStartThing">
                            <option value="false" ${thingSettingDto.autoStartThing?'':'selected'}>否</option>
                            <option value="true" ${thingSettingDto.autoStartThing?'selected':''}>是</option>
                        </select>
                    </div>
                    <div data-role="fieldcontain">
                        <fieldset data-role="controlgroup">
                            <legend>创建事情后的默认状态:</legend>
                            <c:forEach items="${thingSettingDto.availableStatuses}" var="status">
                                <form:radiobutton path="defaultCreatedStatus" value="${status}"
                                                  label="${status.label}"/>
                            </c:forEach>
                        </fieldset>
                    </div>
                </li>
                <li>
                    <div data-role="fieldcontain">
                        <button type="submit" data-theme="b">更新</button>
                    </div>
                </li>
            </ul>
        </form:form>
    </div>
    <script type="text/javascript">
        $(function() {
            <c:if test="${param.result}">
            $("#update_info").fadeIn(800).delay(800).fadeOut(800);
            </c:if>
        });
    </script>
</div>
</body>
</html>